/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package user;

import database.User;
import java.util.ArrayList;
import javax.swing.AbstractListModel;

/**
 *
 * @author Jack
 */
public class SearchListPopulate extends AbstractListModel {
    private final ArrayList<User> listOfUsers;
    
    public SearchListPopulate(ArrayList<User> list){
        this.listOfUsers=list;
    }
    
    // Return the size of the list
    @Override
    public int getSize() {
        return listOfUsers.size();
    }

    // Return an element from the list
    @Override
    public Object getElementAt(int index) {
        String name=listOfUsers.get(index).getName();
        String adress=listOfUsers.get(index).getAdress();
        String phone=listOfUsers.get(index).getPhone();
        return "Name: "+name+", Address: "+adress+", Phone: "+phone;
    }
}
